Here's some of the stuff I ran into so you don't have these problems:
Use >= more, not == because if a value is over it's limit for some STUPID programming reason, it fixes itsself instead of going crazy. If it's a IF statement that wants == thats NOT what I'm talking about. A "<=" doesn't take any longer in machine language to perform than "==" .
Don't use send("]"), use send(G->[u]). I'm about ready to make a define for this so it fixes this anyway.
Don't make structs like this unless you want them to be GLOBAL (and take up your DATA area):
typedef struct {
int joe;
} mystruct;
Make them like this:
typedef struct mystruct {
int joe;
};
Then you just do this:
proc() {
struct mystruct haha;
/* your code here */
}
This makes a "mystruct" struct named "haha" ON THE STACK !
Call modules with mode 3 if you are passing a "user" struct.
Comment your code more, it's really hard to figure out what the HECK you are doing and takes HOURS longer than I have to to figure it out.
Please, PLEASE ! Close your files. Check CAREFULLY to see that you are closing your files at the proper place in your code. I have seen times where the file MAY close sometimes and other times it doesn't. There can only be so many files open at one time.
Don't make a module for EACH little bit of code you have. If it's that small, someone could just include YOUR code in theirs. If you think that there is a good reason for someone to call your "support" modules, then include them seperately. Most of the time they will need a "special" version of your code anyway.
You may want to add some "extras" to your structs, since you may have to live with the structs a while. You can't be shipping a new version every other week that bombs because others are depending on your structs.
THINK about your pointers and WHAT they are doing !! If your module crashes with a "address error" all the time, it's most likely a pointer !
*figure - means make a POINTER variable (not the value of the variable), you then make it POINT to something!
&figure means a POINTER that POINTS to "figure".
Think C (at least 4.0) handles the passing of STRUCTS ! So when you are working with structs, you need to know what Think C is doing with them ! Sometimes it passes a POINTER to the struct, sometimes it passes THE WHOLE STRUCT !
Don't use GLOBALS unless you REALLY have to, they get quite confusing when you think MULTI USER !!